﻿<UserControl x:Class="TFhisto.UI.WorkItemHistory"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:my="clr-namespace:Wpf.Controls;assembly=Wpf.SplitButton" 
             xmlns:my1="clr-namespace:TFhisto.UI" 
             mc:Ignorable="d" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             d:DesignWidth="300">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="listViewTemplates.xaml" />
                <ResourceDictionary Source="ResourceDictionary1.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid Background="{DynamicResource BrushBlue2Purple3}" MaxHeight="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Grid, AncestorLevel=1}, Path=ActualHeight }">
        <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="220" />
                <RowDefinition Height="*" />
                <RowDefinition Height="23" />
            </Grid.RowDefinitions>

        <my:SplitButton Grid.Row="0" Content="Generate Report" Foreground="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}" Height="24" HorizontalAlignment="Right" Margin="0,5,5,0" Name="splitBtnWorkItem" VerticalAlignment="Top" Width="111" Click="btnWorkItems_Click">
            <my:SplitButton.Background>
                <SolidColorBrush Color="{DynamicResource Blue1}"/>
            </my:SplitButton.Background>
            <MenuItem Header="Visualize" Click="btnWorkItems_Click"/>
                <MenuItem Header="Group by">
                    <MenuItem Header="State" CommandParameter="System.State" Click="btnWorkItems_Click" />
                    <MenuItem Header="Area" CommandParameter="System.AreaPath" Click="btnWorkItems_Click" />
                    <MenuItem Header="Iteration" CommandParameter="System.IterationPath" Click="btnWorkItems_Click" />
                    <MenuItem Header="Assigned To"  CommandParameter="System.AssignedTo" Click="btnWorkItems_Click" />
                </MenuItem>
            </my:SplitButton>

        <Button Grid.Row="0" Content="Options" Height="23" HorizontalAlignment="Left" Margin="5,5,0,0" Name="btnOptions" VerticalAlignment="Top" Width="75" Click="btnOptions_Click">
            <Button.BorderBrush>
                <SolidColorBrush Color="{DynamicResource Blue1}"/>
            </Button.BorderBrush>
            <Button.Background>
                <SolidColorBrush Color="{DynamicResource Blue3}"/>
            </Button.Background>
        </Button>

        <GroupBox Grid.Row="0" Header="Project Selection" Height="120" Margin="5,35,5,0" Name="groupBox1" VerticalAlignment="Top">
            <GroupBox.BorderBrush>
                <SolidColorBrush Color="{DynamicResource Purple3}"/>
            </GroupBox.BorderBrush>
            <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="215*" />
                        <ColumnDefinition Width="85" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="70" />
                        <RowDefinition Height="40" />
                    </Grid.RowDefinitions>
                    <my1:TFSUserControl Grid.ColumnSpan="2" Margin="0,-10,0,0" x:Name="tFSUserControl1" VerticalAlignment="Top" Height="Auto" Width="Auto" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch"/>
                    <ComboBox Grid.Row="1" Height="23" IsEnabled="False" Margin="10,2,0,0" Name="cboProjects" VerticalAlignment="Top" Width="Auto" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch"/>
                    <Label Content="Select Project:" Height="28" HorizontalAlignment="Left" Margin="11,52,0,0" Name="label2" VerticalAlignment="Top" Width="159" />
                    <Button Grid.Column="1" Grid.Row="1" Content="Select" Height="23" HorizontalAlignment="Right" Margin="0,1,7,0" Name="btnSelectProject" VerticalAlignment="Top" Width="75" Click="btnSelectProject_Click">
                    <Button.BorderBrush>
                        <SolidColorBrush Color="{DynamicResource Purple1}"/>
                    </Button.BorderBrush>
                    <Button.Background>
                        <SolidColorBrush Color="{DynamicResource Purple2}"/>
                    </Button.Background>
                </Button>
            </Grid>
            </GroupBox>

            <GroupBox Grid.Row="0" Header="Location of output file:" Height="57" Margin="5,158,5,0" Name="groupBox2" VerticalAlignment="top">
            <GroupBox.BorderBrush>
                <SolidColorBrush Color="{DynamicResource Purple3}"/>
            </GroupBox.BorderBrush>
            <Grid>
                    <TextBox Height="23" Margin="0,6,55,0" Name="txtOutput" Text="C:\Users\tfssetup\Documents\Output.dgml" VerticalAlignment="Top" />
                    <Button Content="Browse" Height="23" HorizontalAlignment="Right" Margin="0,5,0,0" Name="btnBrowse" VerticalAlignment="Top" Width="49">
                    <Button.BorderBrush>
                        <SolidColorBrush Color="{DynamicResource Blue1}"/>
                    </Button.BorderBrush>
                    <Button.Background>
                        <SolidColorBrush Color="{DynamicResource Blue3}"/>
                    </Button.Background>
                </Button>
            </Grid>
            </GroupBox>

        <TabControl Grid.Row="1" Background="White" Name="tabControl1" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" MaxWidth="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Grid}, Path=ActualWidth}">
            <TabControl.Resources>
                <Style TargetType="{x:Type TabItem}">
                    <Style.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Background">
                                <Setter.Value>
                                    <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                        <GradientStop Color="#FFF3F3F3" Offset="0"/>
                                        <GradientStop Color="#FFF11818" Offset="1"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </TabControl.Resources>
            <TabControl.BorderBrush>
                <SolidColorBrush Color="{DynamicResource Purple1}"/>
            </TabControl.BorderBrush>
            <TabItem Header="1 > Queries" Foreground="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}" Name="tabQueries">
                <TabItem.Background>
                    <SolidColorBrush Color="{DynamicResource Blue1}"/>
                </TabItem.Background>
                <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
                        <Grid>
                            <TreeView VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" MinHeight="150" Margin="0,5,0,25" Name="tvwQueries" MouseDoubleClick="tvwQueries_MouseDoubleClick" ></TreeView>
                            <Button Content="Edit Query" Height="23" HorizontalAlignment="Right" Margin="0,0,0,0" Name="btnEditQuery" VerticalAlignment="Bottom" Width="75" IsEnabled="False" Click="btnEditQuery_Click">
                            <Button.BorderBrush>
                                <SolidColorBrush Color="{DynamicResource Blue1}"/>
                            </Button.BorderBrush>
                            <Button.Background>
                                <SolidColorBrush Color="{DynamicResource Blue3}"/>
                            </Button.Background>
                        </Button>
                    </Grid>
                    </ScrollViewer>
                </TabItem>
                <TabItem Header="2 > WorkItems" Name="tabWorkItems">
                <TabItem.Background>
                    <SolidColorBrush Color="{DynamicResource Blue2}"/>
                </TabItem.Background>
                <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
                        <Grid>
                            <ListView Width="Auto" MinHeight="150" Name="lstResults" MouseDoubleClick="lstResults_MouseDoubleClick">
                                <ListView.View>
                                <GridView  ColumnHeaderContainerStyle="{DynamicResource ResultHeaderStylePurple}" />
                                </ListView.View>
                            </ListView>
                        </Grid>
                    </ScrollViewer>
                </TabItem>
                <TabItem Header="3 > Options" Name="tabOptions">
                <TabItem.Background>
                    <SolidColorBrush Color="{DynamicResource Blue3}"/>
                </TabItem.Background>
                <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <CheckBox Content="Perform Full Analysis" IsChecked="False" Height="16" HorizontalAlignment="Left" Margin="10,10,0,0" Name="chkFull" VerticalAlignment="Top" Grid.Row="3" Checked="chkFull_Changed" Unchecked="chkFull_Changed" />
                        <CheckBox Content="Perform Dependency Analysis" Height="16" HorizontalAlignment="Left" Margin="10,35,0,0" Name="chkDependencyAnalysis" VerticalAlignment="Top" Checked="chkDependencyAnalysis_Checked" Unchecked="chkDependencyAnalysis_Unchecked" />
                        <CheckBox Content="Hide Intervening Links" Height="16" HorizontalAlignment="Left" Margin="10,60,0,0" Name="chkHideInterveningLinks" VerticalAlignment="Top" Grid.Row="3" />
                        <CheckBox Content="Show Deleted links" IsChecked="False" Height="16" HorizontalAlignment="Left" Margin="10,85,0,0" Name="chkShowDeletedLinks" VerticalAlignment="Top"/>
                        <Label VerticalAlignment="Top" HorizontalAlignment="Left" Content="Select Link Types:" Height="24" Name="label4" Margin="0,112,0,0" />
                        <ListBox Name="lstLinkTypes" VerticalAlignment="Top" OverridesDefaultStyle="False" Height="Auto" MinHeight="120" Margin="0,134,5,0" VerticalContentAlignment="Stretch" Grid.Row="0" Grid.Column="0" HorizontalContentAlignment="Stretch" HorizontalAlignment="Stretch" Width="auto">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Grid Name="LinkTypeList">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="*"/>
                                        </Grid.RowDefinitions>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="30"/>
                                            <ColumnDefinition Width="*"/>
                                        </Grid.ColumnDefinitions>
                                        <CheckBox Grid.Column="0" IsChecked="{Binding Path=Selected}" IsEnabled="{Binding Path=Enabled}" VerticalAlignment="Center" Checked="chkLinkTypes_Changed" Unchecked="chkLinkTypes_Changed"></CheckBox>
                                        <Label Grid.Column="1" Content="{Binding Path=LinkType}"></Label>
                                    </Grid>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>

                    </Grid>
                </TabItem>
            </TabControl>

        <StatusBar Grid.Row="2" Height="23" Foreground="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="statusBar" VerticalAlignment="Top">
            <StatusBarItem >
                <StatusBarItem.Background>
                    <SolidColorBrush Color="{DynamicResource Blue1}"/>
                </StatusBarItem.Background>
            </StatusBarItem>
        </StatusBar>
    </Grid>
</UserControl>
